using Awaiter;
using Nsb;
using YesPlayLove.Classes;
using Yoshi.Classes;
using jQueryApi;

namespace YoshiFlowMain
{
    public sealed class PublicPage : YoshiPage
    {
        public PublicPage()
        {
            PublicBuildAw(Await.AsyncAw, PublicPageTheme.PageTitle);
        }

        public override void RefreshAw(Await awp)
        {
            jQuery.FromHtml("<h2/>").Html("Hello <b>&#9788;</b>").CSS("margin", "50px").AppendTo(PageCluster);

            jQueryObject login = jQuery.FromHtml("<div/>").AppendTo(PageCluster);
            PageCluster.AddClass(ThemeBase.CurrentPageClass);

            jQuery.FromHtml("<p class='Login'/>")
                .AppendTo(login)
                .Html("Click here to log in using your Facebook account <img src='http://www.onewoundcare.com/files/7013/0023/9799/facebook-button.jpg' style='margin:0;padding:0;float:left'>")
                .Click(
                    delegate
                    {
                        Storage.SetLocal("Page", AllPages.HomePage);
                        new Await()
                            .AddAw(Master.FbData.AuthenticateAw)
                            .AddDx(delegate { Master.GoPage(AllPages.HomePage); })
                            .Commit();
                    }
                )
                ;


            new Await()
                //.AddAw(FeedBubble.NewAw, feed)
                .Commit(awp);
        }
    }
}
